<template>
    <div>
        <Layout>
            <div slot="main">
                <div v-html="text"></div>
                <span>{{time}}</span>
            </div>
        </Layout>
    </div>
</template>
<script>
import Layout from '../../components/Layout.vue'
export default {
    components: {
        Layout
    },
    data() {
        return {
            text: '',
            time: ''
        }
    },
    created() {
        this.getData()
    },
    methods: {
        getData() {
            this.$axios.get(`/api/doc/detail?id=${this.$route.query.id}`).then(res => {
                if (res.data.code === 1) {
                    this.text = res.data.data.text
                    this.time = this.$moment(new Date(+res.data.data.createTime)).format('YYYY-MM-DD')
                    console.log(res.data)
                } else {
                    alert(res.data.msg)
                }
            })
        }
    },

}
</script>
<style lang="scss">
    .form {
        width: 500px;
    }
    
</style>